package com.zys.background.common.constant;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;

/**
 * @author zys
 * @since 2022-11-25
 */
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class Rabbits {
  /**
   * 备份交换机
   */
  public static final String ALTERNATE_EXCHANGE = "alternate-exchange";
  /**
   * 死信交换机
   */
  public static final String X_DEAD_LETTER_EXCHANGE = "x-dead-letter-exchange";
  /**
   * 死信交换机 Routing key
   */
  public static final String X_DEAD_LETTER_ROUTING_KEY = "x-dead-letter-routing-key";
  /**
   * 死信交换机的类型
   */
  public static final String X_DELAYED_TYPE = "x-delayed-type";
  /**
   * 当队列在指定的时间内没有被使用(访问)就会被删除
   */
  public static final String X_EXPIRES = "x-expires";
  /**
   * 队列可以容纳的消息的最大条数,超过这个条数,队列头部的消息将会被丢弃.
   */
  public static final String X_MAX_LENGTH = "x-max-length";
  /**
   * 队列可以容纳的消息的最大字节数,超过这个字节数,队列头部的消息将会被丢弃
   */
  public static final String X_MAX_LENGTH_BYTES = "x-max-length-bytes";
  /**
   * 设置该队列中的消息的优先级最大值
   */
  public static final String X_MAX_PRIORITY = "x-max-priority";
  /**
   * 队列中的消息的生存周期,单位毫秒
   */
  public static final String X_MESSAGE_TTL = "x-message-ttl";
  /**
   * 设置队列为惰性队列 lazy/默认 default,具体模式: {@link QueueMode}
   */
  public static final String X_QUEUE_MODE = "x-queue-mode";
  /**
   *
   */
  public static final String X_QUEUE_MASTER_LOCATOR = "x-queue-master-locator";
  /**
   * 队列中的消息溢出时,如何处理这些消息.要么丢弃队列头部的消息,要么拒绝接收后面生产者发送过来的所有消息. drop-head / reject-publish
   * 具体模式: {@link Overflow}
   */
  public static final String X_OVERFLOW = "x-overflow";

  @NoArgsConstructor(access = AccessLevel.PRIVATE)
  public static class Overflow {
    public static final String DROP_HEAD = "drop-head";
    public static final String REJECT_PUBLISH = "reject-publish";
  }

  @NoArgsConstructor(access = AccessLevel.PRIVATE)
  public static class QueueMode {
    public static final String DEFAULT = "default";
    public static final String LAZY = "lazy";
  }
}
